package com.sibrary.components;

import com.sibrary.booxoo.BooxooMainActivity;

import android.graphics.Bitmap;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.WebView.HitTestResult;

public class CustomWebViewClient extends WebViewClient {

	private BooxooMainActivity mMainActivity;

	public CustomWebViewClient(BooxooMainActivity mainActivity) {
		super();
		mMainActivity = mainActivity;
	}

	@Override
	public boolean shouldOverrideUrlLoading(WebView view, String url) {
		return false;
	}
	
	@Override
	public void onPageStarted(WebView view, String url, Bitmap favicon) {
		((CustomWebView) view).notifyPageStarted();
		mMainActivity.onPageStarted(url);
		
		super.onPageStarted(view, url, favicon);
	}
	
	@Override
	public void onPageFinished(WebView view, String url) {		
		((CustomWebView) view).notifyPageFinished();
		mMainActivity.onPageFinished(url);
		
		super.onPageFinished(view, url);
	}
}
